#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = "Administrator"
__name__="Python_process"
__date__="2016/8/3"
__time__="18:47"
"""
from multiprocessing import Process,Lock
import time
def f(l,i):
    time.sleep(0.5)
    print 'hello',i

if __name__ == '__main__':
    lock = Lock()
    for n in range(100):    # 不能控制并发数量，只能是启动多少进程，并发数是多少
        Process(target=f,args=(lock,n)).start()

# 改成串行执行：
"""
p = Process(target=f,args=(lock,n))
p.start()
p.join() # join()等待
"""

